package com.bjesc_b2c.app.appraiset.mvp.presenter.impl;

import android.content.Context;

import com.bjesc_b2c.app.appraiset.bean.PutTouristsBean;
import com.bjesc_b2c.app.appraiset.bean.TouristsBean;
import com.bjesc_b2c.app.appraiset.mvp.model.CustomerModel;
import com.bjesc_b2c.app.appraiset.mvp.model.impl.CustomerModelImpl;
import com.bjesc_b2c.app.appraiset.mvp.presenter.CustomerPresenter;
import com.bjesc_b2c.app.appraiset.mvp.view.CustomerView;

import rxretrofit_base.model.TokenBean;

/**
 * Created by yidong on 2017/5/24.
 */

public class CustomerPresenterImpl implements CustomerPresenter,CustomerModelImpl.CallBack{
    private CustomerView cusView;
    private CustomerModel customerModel;
    public CustomerPresenterImpl(CustomerView cusView){
        this.cusView = cusView;
        customerModel = new CustomerModelImpl(this);
    }
    @Override
    public void requestCustomer(String id,int type) {
        customerModel.requestCustomer((Context)cusView,id,type);
    }

    @Override
    public void modifyCustimerInfo(Context context, String disid, PutTouristsBean infoBean, int type) {
        customerModel.modifyCustimerInfo(context,disid,infoBean,type);
    }

    @Override
    public void createOrder(Context context, String dis_id, PutTouristsBean infoBean) {
        customerModel.createOrder(context,dis_id,infoBean);
    }

    @Override
    public void callback(TouristsBean bean) {
        cusView.getCustimerInfo(bean);
    }
    @Override
    public void loadStart() {
        cusView.loadStart();
    }

    @Override
    public void loadCompleted() {
        cusView.loadCompleted();
    }

    @Override
    public void loadFailure() {
        cusView.loadFailure();
    }

    @Override
    public void onSuccess(TokenBean bean) {
        cusView.onSuccess(bean);
    }
}
